package com.tencent.mm.opensdk.a;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.tencent.mm.opensdk.a.a.b;
import com.tencent.mm.opensdk.b.d;

public final class aa {
    public static final class a$a {
        public String a;
        public String b;
        public String c;
        public Bundle d;
        public int flags;

        public a$a() {

            this.flags = -1;
        }

        public final String toString() {
            return "targetPkgName:" + this.a + ", targetClassName:" + this.b + ", content:" + this.c + ", flags:" + this.flags + ", bundle:" + this.d;
        }
    }

    public static boolean a(Context arg6, a$a arg7) {
        int v5 = 603979778;
        boolean v0 = false;
        if(arg6 == null) {
            Log.e("MicroMsg.SDK.MMessageAct", "send fail, invalid argument");
            return v0;
        }

        if(d.a(arg7.a)) {
            Log.e("MicroMsg.SDK.MMessageAct", "send fail, invalid targetPkgName, targetPkgName = " + arg7.a);
            return v0;
        }

        if(d.a(arg7.b)) {
            arg7.b = arg7.a + ".wxapi.WXEntryActivity";
        }

        Log.d("MicroMsg.SDK.MMessageAct", "send, targetPkgName = " + arg7.a + ", targetClassName = " + arg7.b);
        Intent v1 = new Intent();
        v1.setClassName(arg7.a, arg7.b);
        if(arg7.d != null) {
            v1.putExtras(arg7.d);
        }

        String v2 = arg6.getPackageName();
        v1.putExtra("_mmessage_sdkVersion", v5);
        v1.putExtra("_mmessage_appPackage", v2);
        v1.putExtra("_mmessage_content", arg7.c);
        v1.putExtra("_mmessage_checksum", b.a(arg7.c, v5, v2));
        if(arg7.flags == -1) {
            v1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).addFlags(134217728);
        }
        else {
            v1.setFlags(arg7.flags);
        }

        try {
            arg6.startActivity(v1);
        }
        catch(Exception v1_1) {
            Log.e("MicroMsg.SDK.MMessageAct", "send fail, ex = " + v1_1.getMessage());
            return v0;
        }

        Log.d("MicroMsg.SDK.MMessageAct", "send mm message, intent=" + v1);
        return true;
    }
}

